package demo.config;

import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author m0v1
 * @date 2021年09月20日 11:49 下午
 */
@Configuration
@EnableDubbo(scanBasePackages = "demo.service.impl")
@PropertySource("classpath:dubbo-provider.properties")
public class ProviderConfig {
    private static final String ZOOKEEPER_IP = "192.168.2.10";
    private static final int ZOOKEEPER_PORT = 2181;

    @Bean
    public RegistryConfig registryConfig(){
        RegistryConfig registryConfig = new RegistryConfig();
        registryConfig.setAddress("zookeeper://" + ZOOKEEPER_IP + ":" + ZOOKEEPER_PORT);
        registryConfig.setTimeout(10000);

        return registryConfig;
    }
}
